<?php
require_once('/includes/general.php');
/**
 * This class has all the method to interact with database.
 */ 
class ProductService{
    
    public function getProduct($iProductId){
        tep_db_checkDb() or die('Cannot connect to database');
        $sqlQuery = 'select * from tbl_san_pham where id='.$iProductId;
        $query = tep_db_query($sqlQuery);
        return tep_db_fetch_array($query);
    }
    public function getSanphamnoibatright(){
        $sql='select * from tbl_san_pham where hien_san_pham_noi_bat=1';
        $kq=tep_db_query($sql);
        return tep_db_fetch_array($kq);
    }
    public function getSanphamtheodanhmuc($iMadanhmuc){
        $sql='select * from tbl_san_pham where ma_danh_muc='.$iMadanhmuc;
        $kq=tep_db_query($sql);
        return tep_db_fetch_array($kq);
    }
}

?>